﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using MySql.Data.MySqlClient;
using Models;
using DAL;

namespace BLL
{
    public class GiveClanManager
    {
        GiveClanService gcs = new GiveClanService();
        /// <summary>
        /// 查询道具是否存在
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool QuestItem(string id)
        {
            if (gcs.QuestItem(id, 1) || gcs.QuestItem(id, 2) || gcs.QuestItem(id, 3))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 查询血盟是否存在,目前没用到
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool QuestClan(string name)
        {
            if (gcs.QuestClan(name))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 获取全部血盟
        /// </summary>
        /// <returns></returns>
        public DataView GetAllClan()
        {
            DataView dvClan = new DataView();
            dvClan.Table = dvClan.Table = gcs.GetAllClan().Tables["ClanTable"];
            dvClan.Sort = "count desc";
            return dvClan;
        }

        /// <summary>
        /// 发送道具
        /// </summary>
        /// <param name="clanID"></param>
        /// <param name="itemID"></param>
        /// <param name="count"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public string AddItem(int clanID,int itemID, int count, int level, int type)
        {
            return gcs.AddItemBYCharID(clanID, itemID, count, level, type);
        }

        public string AddItemBYAccID(string accid, int itemID,int count)
        {
            return gcs.AdditemBYAccID(accid, itemID,count);
        }
        public int ItemType(int itemID)
        {
            return gcs.ItemType(itemID);
        }
    }
}
